<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="common/header.jsp"%>

<div class="center">
			<div class="col-main">
				<div class="main-wrap" style="background-color:white;">

					<div class="user-order">

						<!--标题 -->
						<div class="am-cf am-padding">
							<c:if test="${proType==1}">
								<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">门票订单管理</strong> / <small>Order</small></div>
							</c:if>
							<c:if test="${proType==2}">
								<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">酒店订单管理</strong> / <small>Order</small></div>
							</c:if>
							<c:if test="${proType==4}">
								<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">旅游订单管理</strong> / <small>Order</small></div>
							</c:if>
						</div>
						<hr/>

						<div class="am-tabs am-tabs-d2 am-margin" data-am-tabs>

							<ul class="am-avg-sm-5 am-tabs-nav am-nav am-nav-tabs">
								<li class="am-active"><a href="#tab1">订单</a></li>
								<li><a href="#tab2">待付款</a></li>
								<li><a href="#tab3"></a></li>
								<li><a href="#tab4"></a></li>
								<li><a href="#tab5"></a></li>
							</ul>

							<div class="am-tabs-bd">
								<div class="am-tab-panel am-fade am-in am-active" id="tab1">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>
								<c:forEach var="bill" varStatus="status" items="${bill}">
									<div class="order-main">
										<div class="order-list">
											
											<!--交易成功-->
											<div class="order-status5">
												<div class="order-title">
													<div class="dd-num">订单编号：<a href="javascript:;">${bill.b_id}</a></div>
													<span>成交时间：<fmt:formatDate value="${bill.createDate}"/></span>
													<!--    <em>店铺：小桔灯</em>-->
												</div>
												<div class="order-content">
													<div class="order-left">
														<ul class="item-list">
															<li class="td td-item">
																<div class="item-pic">
																	<a href="#" class="J_MakePoint">
																		<img src="../images/kouhong.jpg_80x80.jpg" class="itempic J_ItemImg">
																	</a>
																</div>
																<div class="item-info">
																	<div class="item-basic-info">
																		<a href="#">
																			<p>${bill.p_Name}</p>
																			<p>购买人:${bill.userName }</p>
																			<p class="info-little">房型：${bill.roomName}
																		</a>
																	</div>
																</div>
															</li>
															<li class="td td-price">
																<div class="item-price">
																	${bill.price}
																</div>
															</li>
															<li class="td td-number">
																<div class="item-number">
																	<span>×</span>${bill.count}
																</div>
															</li>
															<li class="td td-operation">
																<div class="item-operation">
																	
																</div>
															</li>
														</ul>

														
													</div>
													<div class="order-right">
														<li class="td td-amount">
															<div class="item-amount">
																${bill.price*bill.count}
															</div>
														</li>
														<div class="move-right">
															<li class="td td-status">
																<div class="item-status">
																	<p class="Mystatus">
																		<c:if test="${bill.isPay==1}">用户已支付</c:if>
																		<c:if test="${bill.isPay==0}">用户未支付</c:if>
																	</p>
																	<p class="Mystatus">
																		<c:if test="${bill.isPay==1 && bill.status==1}">已确认</c:if>
																		<c:if test="${bill.isPay==1 && bill.status==0}">商家未确认</c:if>
																	</p>
																	<p class="order-info"><a style="color:red;" href="${pageContext.request.contextPath }/user/orderInfo?b_id=${bill.b_id}&proType=${proType}">订单详情</a></p>
																</div>
															</li>
															<li class="td td-change">
																<div class="am-btn am-btn-danger anniu">
																	<c:if test="${bill.status==1 && bill.isPay==1}">
																		<a href="javascript:;"  
																			b_id="${bill.b_id}" p_Name="${bill.p_Name}" id="delete">
																		删除订单
																		</a>
																	</c:if>
																	<c:if test="${bill.isPay==0}">
																		<a href="${pageContext.request.contextPath }/user/payment?proType=${bill.proType}&b_id=${bill.b_id}&isPay=1"
																			onclick="if(confirm('确定支付?')==false)return false;">
																		支付订单
																		</a>
																	</c:if>
																	<c:if test="${bill.isPay==1 && bill.status==0}">
																		<a href="javascript:void(0);">
																		提醒商家确认
																		</a>
																	</c:if>
																</div>
															</li>
														</div>
													</div>
												</div>
											</div>
											
										</div>

									</div>
								</c:forEach>
								<div class="row">
										<div class="col-sm-5">
											<div class="dataTables_info" id="datatable-responsive_info"
												role="status" aria-live="polite">共${pages.totalCount }条记录
												${pages.currentPageNo }/${pages.totalPageCount }页</div>
										</div>
										<div class="col-sm-7">
											<div class="dataTables_paginate paging_simple_numbers"
												id="datatable-responsive_paginate">
												<ul class="pagination">
													<c:if test="${pages.currentPageNo > 1}">
														<li class="paginate_button previous"><a
															href="${pageContext.request.contextPath }/user/order.html?pageIndex=1&u_id=${u_id}&proType=${proType}"
															aria-controls="datatable-responsive" data-dt-idx="0"
															tabindex="0">首页</a>
														</li>
														<li class="paginate_button "><a
															href="${pageContext.request.contextPath }/user/order.html?pageIndex=${pages.currentPageNo-1}&u_id=${u_id}&proType=${proType}"
															aria-controls="datatable-responsive" data-dt-idx="1"
															tabindex="0">上一页</a>
														</li>
													</c:if>
													<c:if test="${pages.currentPageNo < pages.totalPageCount }">
														<li class="paginate_button "><a
															href="${pageContext.request.contextPath }/user/order.html?pageIndex=${pages.currentPageNo+1 }&u_id=${u_id}&proType=${proType}"
															aria-controls="datatable-responsive" data-dt-idx="1"
															tabindex="0">下一页</a>
														</li>
														<li class="paginate_button next"><a
															href="${pageContext.request.contextPath }/user/order.html?pageIndex=${pages.totalPageCount }&u_id=${u_id}&proType=${proType}"
															aria-controls="datatable-responsive" data-dt-idx="7"
															tabindex="0">最后一页</a>
														</li>
													</c:if>
												</ul>
											</div>
										</div>
								</div>
							</div>
								<div class="am-tab-panel am-fade" id="tab2">

									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>
									<c:forEach var="bill" varStatus="status" items="${bill}">
										<div class="order-main">
											<div class="order-list">
												<c:if test="${bill.isPay==0}">
													<!--未付款-->
													<div class="order-status5">
														<div class="order-title">
															<div class="dd-num">订单编号：<a href="javascript:;">${bill.b_id}</a></div>
															<span>成交时间：<fmt:formatDate value="${bill.createDate}"/></span>
															<!--    <em>店铺：小桔灯</em>-->
														</div>
														<div class="order-content">
															<div class="order-left">
																<ul class="item-list">
																	<li class="td td-item">
																		<div class="item-pic">
																			<a href="#" class="J_MakePoint">
																				<img src="../images/kouhong.jpg_80x80.jpg" class="itempic J_ItemImg">
																			</a>
																		</div>
																		<div class="item-info">
																			<div class="item-basic-info">
																				<a href="#">
																					<p>${bill.p_Name}</p>
																					<p>入住人:${bill.t_Name }</p>
																					<p class="info-little">房型：${bill.roomName}
																				</a>
																			</div>
																		</div>
																	</li>
																	<li class="td td-price">
																		<div class="item-price">
																			${bill.price}
																		</div>
																	</li>
																	<li class="td td-number">
																		<div class="item-number">
																			<span>×</span>${bill.count}
																		</div>
																	</li>
																	<li class="td td-operation">
																		<div class="item-operation">
																			
																		</div>
																	</li>
																</ul>
		
																
															</div>
															<div class="order-right">
																<li class="td td-amount">
																	<div class="item-amount">
																		${bill.price*bill.count}
																	</div>
																</li>
																<div class="move-right">
																	<li class="td td-status">
																		<div class="item-status">
																			<p class="Mystatus">
																				<c:if test="${bill.isPay==1}">用户已支付</c:if>
																				<c:if test="${bill.isPay==0}">用户未支付</c:if>
																			</p>
																			<p class="Mystatus">
																				<c:if test="${bill.isPay==1 && bill.status==1}">已确认</c:if>
																				<c:if test="${bill.isPay==1 && bill.status==0}">商家未确认</c:if>
																			</p>
																			<p class="order-info"><a style="color:red;" href="${pageContext.request.contextPath }/user/orderInfo?b_id=${bill.b_id}&proType=${proType}">订单详情</a></p>
																			
																		</div>
																	</li>
																	<li class="td td-change">
																		<div class="am-btn am-btn-danger anniu">
																			<c:if test="${bill.status==1 && bill.isPay==1}">删除订单</c:if>
																			<c:if test="${bill.isPay==0}">支付订单</c:if>
																			<c:if test="${bill.isPay==1 && bill.status==0}">提醒商家确认</c:if>
																			</div>
																	</li>
																</div>
															</div>
														</div>
													</div>
												</c:if>
											</div>
	
										</div>
									</c:forEach>
								</div>
							</div>

						</div>
					</div>
				</div>
</div>
<%@include file="common/footer.jsp"%>
</div>

	</body>
<script type="text/javascript">
	
	
			$("#delete").on("click",function(){
				var obj = $(this);
				var bid = obj.attr("b_id");
				if(confirm("是否要删除【"+obj.attr("p_Name")+"】")){
					$.ajax({
						url : "/Trip/user/del",
						dataType : "json",
						data : {b_id:bid},
						type : "GET",
						success : function(date){
							if(date == "success"){
								alert("删除成功!");
								window.location.reload();
							}else if(date == "error"){
								alert("删除失败!");
								window.location.reload();
							};
						}
					});
				
				}
			});
		
	

</script>
</html>